package com.l4.software.pixie.kernel;


public class DColor {

	public int R = 0;

	public int G = 0;

	public int B = 0;
	
	public int A = 0;

	private DColor() {
	}


	public static boolean equals(final DColor a, final DColor b) {
		return (a.R == b.R) && (a.G == b.G) && (a.B == b.B);
	}


	public static DColor getLColor(int pixel) {
		DColor color = new DColor();
		color.R = (pixel & 0x00ff0000) >> 16;
		color.G = (pixel & 0x0000ff00) >> 8;
		color.B = pixel & 0x000000ff;
		color.A = (pixel >> 24) & 0xff;
		return color;
	}


	public int getPixel(final DColor color) {
		return (color.R << 16) | (color.G << 8) | color.B;
	}

	public int getPixel() {
		return (R << 16) | (G << 8) | B;
	}

	public DColor(final int r, final int g, final int b) {
		this.R = r;
		this.G = g;
		this.B = b;
	}

	public static DColor fromArgb(final int r, final int g, final int b) {
		return new DColor(r, g, b);
	}

}
